package repositories;

import java.util.Collection;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import domain.Ownership;

@Repository
public interface OwnershipRepository extends JpaRepository<Ownership,Integer> {
	
	// List the ownership history of a painting
	@Query("select o from Ownership o where o.ownedPainting.id = ?1")
	Collection<Ownership> findOwnershipByPaintingId(int paintingId);

}
